import React, { createContext,useReducer } from 'react';

export const ColorConst=createContext({});
export const UpDateColor="UpDateColor";
const reducer=(state,action)=>{
    switch(action.type){
        case UpDateColor:
            return action.color
        default:
            return state
    }
}
export const  Color=props=>{
    const[color,dispatch]=useReducer(reducer,'blue')
    return(
        <ColorConst.Provider value={{color,dispatch}}>
            {props.children}
        </ColorConst.Provider>
    )
}